package com.heyqing.topic.MyStack_0225;

import java.util.ArrayList;
import java.util.List;
import java.util.Queue;

/**
 * ClassName:MyStack
 * Package:com.heyqing.topic.MyStack_0225
 * Description:
 *
 * @Date:2024/9/23
 * @Author:Heyqing
 */
public class MyStack {

    private List<Integer> myStack;

    public MyStack() {
        myStack = new ArrayList<>();
    }

    public void push(int x) {
        myStack.add(x);
    }

    public int pop() {
        int popElement = myStack.get(myStack.size() - 1);
        myStack.remove(myStack.size() - 1);
        return popElement;
    }

    public int top() {
        return myStack.get(myStack.size() - 1);
    }

    public boolean empty() {
        return myStack.isEmpty();
    }

}
